One or more embodiments relate to the fields of video post-processing and image enhancement. More particularly, one embodiment relates to a method and apparatus for edge handling in image processing.
Current digital televisions (DTV) may provide video post-processing and/or image enhancement in a display processing pipeline of the DTV following decoding of an encoded media signal but prior to display of the decoded digital video frames. Examples of video post-processing include horizontal and vertical video scaling. Horizontal and vertical video scaling in DTV chips may be implemented using a polyphase filter. Generally, video scaling can be viewed as an interpolation/decimation process, which involves producing a larger/smaller (depending on the scaling factor) number of output pixels from a set of input pixels. When scaling is implemented using a polyphase filter, each output pixel produced is a function of N, input pixels.
Generally, N is an integer referring to a number of taps provided by the polyphase filter to perform the scaling process. The N, input pixels required to produce an output pixel are generally centered on a position of the output pixel, for example, when using a symmetric polyphase filter. While this works for most of the output pixels, it poses a problem at the edges of a pixel frame. In fact, at least one of the input pixels required to produce an output pixel at a pixel frame boundary does not exist.
As an example, consider scaling (upscaling) from 720 horizontal pixels to 1920 pixels. Assume the number of taps or N in this example is equal to nine. Based on this number of taps, to produce output pixel zero (pixels being numbered 0-1919), nine input pixels are needed, centered around zero. While input pixels 0-4 are present, pixels −4 to −1 do not exist. Likewise, output pixel computation for output pixels 1, 2 and 3 will also have missing input pixels. Although the number of missing pixels reduces and ultimately disappears as subsequent output pixels are computed, the problem reoccurs at the right edge of the pixel frame (top and bottom edge (for vertical scaling)), namely, input pixels to the right of input pixel 719 (for a 720 line width pixel frame) also do not exist.
To handle this problem, several edge handling methods currently exist. These methods involve padding extra edge pixels around the pixel frame. The methods include replication (in the above example, pixels −4 to −1 all take the value of pixel 0); mirroring, wherein pixels −4 to −1 take the values of pixels 1-4; and zero-based, where pixels −4 to −1 are simply set to zero.
Implementation of any one of the above methods typically involves the actual creation of these padded pixels by software or other hardware units and storing them in memory prior to performance of the scaling operation. As a result, the video scaler reads the complete padded image. Often times hardware vendors ignore the edge handling problem altogether and compromise the quality of scaling at pixel frame edges.